Skip to content

Use the dimension attribute aspect ratio for srcset source selection - #64084

Merged
chromium-wpt-export-bot merged 1 commit into
masterfrom
chromium-export-21d135b184
Oct 27, 2026
Merged

chromium-wpt-export-bot merged 1 commit into
masterfrom
chromium-export-21d135b184

Conversation

@chromium-wpt-export-bot

Copy link
Copy Markdown
Collaborator

Third part of whatwg/html#13053, behind the
SrcsetTwoDimensionalSizes runtime flag.

For srcset candidates without an h descriptor, use the dimension
attribute aspect ratio (from the width/height attributes of the
\<img>, or of the \<source> when it has one of them) as the source
aspect ratio when computing the source concrete width for a
two-dimensional size. This is also applied in the preload scanner.

Since these attributes now affect source selection, changing them on an
\<img> or a previous sibling \<source> is a relevant mutation, so re-run
source selection. To keep that re-selection side-effect free when the
selected URL did not change, SelectSourceURL() now only resets the
layout disposition when it actually updates the image loader.

Bug: 572724710
Change-Id: I2317a0b452ef8f0ca2438c41d8574312d19b9135
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8563321
Reviewed-by: Stefan Zager <szager@chromium.org>
Commit-Queue: Noam Rosenthal <nrosenthal@google.com>
Cr-Commit-Position: refs/heads/main@{#1724591}

Third part of whatwg/html#13053, behind the
`SrcsetTwoDimensionalSizes` runtime flag.

For srcset candidates without an `h` descriptor, use the dimension
attribute aspect ratio (from the `width`/`height` attributes of the
`<img>`, or of the `<source>` when it has one of them) as the source
aspect ratio when computing the source concrete width for a
two-dimensional size. This is also applied in the preload scanner.

Since these attributes now affect source selection, changing them on an
`<img>` or a previous sibling `<source>` is a relevant mutation, so re-run
source selection. To keep that re-selection side-effect free when the
selected URL did not change, `SelectSourceURL()` now only resets the
layout disposition when it actually updates the image loader.

Bug: 572724710
Change-Id: I2317a0b452ef8f0ca2438c41d8574312d19b9135
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8563321
Reviewed-by: Stefan Zager <szager@chromium.org>
Commit-Queue: Noam Rosenthal <nrosenthal@google.com>
Cr-Commit-Position: refs/heads/main@{#1724591}

@wpt-pr-bot wpt-pr-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

@jonathan-j-lee

Copy link
Copy Markdown
Contributor

Retrying due to transient GitHub Actions artifact download failure.

@chromium-wpt-export-bot
chromium-wpt-export-bot merged commit 41a91b9 into master Oct 27, 2026
52 of 53 checks passed
@chromium-wpt-export-bot
chromium-wpt-export-bot deleted the chromium-export-21d135b184 branch October 27, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants